<?php

/**
 * \file
 * Classe `String`.
 */

namespace pilar\Entities /* \cond */ ; /* \endcond */
{

/**
 * Membre de texte à taille non fixe.
 *
 * \since 01/08/2008
 * \author Matthieu OVIEDO <matthieu.oviedo@gmail.com>
 */
class String extends Member {

protected function loadDefaultParams() {
 parent::loadDefaultParams();

 $this->params->define(array(
  'maxLength' => 255,                 // Longueur maximale du texte.
  'caseSensitive' => false,
  'defaultValue' => ''
 ));
}


protected function initialize() {
 parent::initialize();

 $this->addField(
  new \pilar\Entities\Fields\Varchar(array(
   'maxLength' => $this->param('maxLength'),
   'caseSensitive' => $this->param('caseSensitive'),
   'defaultValue' => $this->param('defaultValue')
  ))
 );
}


protected function defaultFormMemberParams() {
 if($this->param('formClass') == '\\pilar\\SimpleFormMembers\\TextBox') {
  return array(
   'maxLength' => $this->param('maxLength')
  );
 }

 return parent::defaultFormMemberParams();
}


} // Class.

} // Namespace.

?>
